#pragma once
#include <memory>
#include "BaseAST.h"
using std::unique_ptr;
class ExprAST : public BaseAST
{
public:
    virtual ~ExprAST() = default;
    virtual void Dump() const = 0;
    virtual int Calc() const = 0;
    virtual bool is_const() const = 0;
};
class ExpAST :
    public ExprAST
{
public:
    unique_ptr<ExprAST>content;
    void Dump() const override;
    int Calc()const override;
    bool is_const()const override;
};

class PrimaryAST :
    public ExprAST
{
public:
    enum { Exp, Number }type;
    unique_ptr<ExprAST>content;
    void Dump() const override;
    int Calc()const override;
    bool is_const()const override;
};

class NumberAST :
    public ExprAST
{
public:
    int content;
    void Dump() const override;
    int Calc()const override;
    bool is_const()const override;
};


class UnaryAST :
    public ExprAST
{
public:
    enum { POS, NEG, NOT, DEFAULT }op;
    unique_ptr<ExprAST>content;
    void Dump() const override;
    int Calc()const override;
    bool is_const()const override;
};

class MulAST :
    public ExprAST
{
public:
    enum { MUL, DIV, MOD, DEFAULT }op;
    unique_ptr<ExprAST>exp1;
    unique_ptr<ExprAST>exp2;
    void Dump() const override;
    int Calc()const override;
    bool is_const()const override;
};

class AddAST :
    public ExprAST
{
public:
    enum { ADD, SUB, DEFAULT }op;
    unique_ptr<ExprAST>exp1;
    unique_ptr<ExprAST>exp2;
    void Dump() const override;
    int Calc()const override;
    bool is_const()const override;
};

class RelAST :
    public ExprAST
{
public:
    enum { GT, LT, GE, LE, DEFAULT }op;
    unique_ptr<ExprAST>exp1;
    unique_ptr<ExprAST>exp2;
    void Dump() const override;
    int Calc()const override;
    bool is_const()const override;
};

class EqAST :
    public ExprAST
{
public:
    enum { EQ, NE, DEFAULT }op;
    unique_ptr<ExprAST>exp1;
    unique_ptr<ExprAST>exp2;
    void Dump() const override;
    int Calc()const override;
    bool is_const()const override;
};

class LAndAST :
    public ExprAST
{
public:
    bool op;
    unique_ptr<ExprAST>exp1;
    unique_ptr<ExprAST>exp2;
    void Dump() const override;
    int Calc()const override;
    bool is_const()const override;
};

class LOrAST :
    public ExprAST
{
public:
    bool op;
    unique_ptr<ExprAST>exp1;
    unique_ptr<ExprAST>exp2;
    void Dump() const override;
    int Calc()const override;
    bool is_const()const override;
};